# -*- coding: utf-8 -*-
# @desc: 
# @file: full_order_selector.py
# @author: Lin Jackey Lyu (me@linlyu.com)
# @date: 2019/2/27 13:49
import random
from .base_selector import AbstractSelector, Order


class ExampleFullOrder(AbstractSelector):

    def __init__(self) -> None:
        super().__init__()
        self.last_amount = None

    def select(self, day) -> list:
        if self.last_amount is not None:
            if random.randint(0, 100) > 10:
                return []
        if self.last_amount is None or self.last_amount < 0:
            amount = 1000
        else:
            amount = -1000

        self.last_amount = amount
        order = Order(stock="000001.XSHE", price=None, amount=amount)
        return [order]
